package com.eaoa.uc.busvehicle.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.bus.BusVehicleQuery;
import com.eaoa.uc.busvehicle.form.BusVehicleCondition;
import com.eaoa.uc.busvehicle.form.BusVehicleSearchForm;

public class BusVehicleManageSearchAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		BusVehicleSearchForm sform = (BusVehicleSearchForm) form;
		sform.initConditionPost();
		BusVehicleCondition condition = (BusVehicleCondition) sform.getCondition();
		
		BusVehicleQuery query = new BusVehicleQuery();
		query.setVehiclecode(condition.getVehiclecode());
		query.setDriver(condition.getDriver());
		query.setIslock("N");
		query.setPageRange(sform.getPageinfo());
		query.execute();
		
		request.setAttribute("results", query.getResults());
		
		return mapping.findForward("success");
	}
}
